<!--
 * @Description: 
 * @Author: 王紫琪
 * @Date: 2021-07-14 15:08:24
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2022-01-10 16:42:04
-->



<template>
    <div id="linechart" style="height: 95%"></div>
</template>
<script>
import { Line } from '@antv/g2plot'
export default {
    mounted () {
    const data = [
      { year: '1991', value: 3 },
      { year: '1995', value: 4 },
      { year: '2001', value: 3.5 },
      { year: '2005', value: 5 },
      { year: '2009', value: 4.9 },
      { year: '2012', value: 6 },
      { year: '2015', value: 17 },
      { year: '2019', value: 18 },
      { year: '2021', value: 19 },
    ];

    const linePlot = new Line('linechart', {
      title: {
        visible: true,
        text: '折线图',
      },
      description: {
        visible: true,
        text: '用平滑的曲线代替折线。',
      },
      data,
      xField: 'year',
      yField: 'value',
    });

    linePlot.render();
  }
}
</script>